#include<iostream>
using namespace std;


int solve(string nums) {
	if (nums.size() == 0 || (nums[0] == '0'))
		return 0;
	if (nums.size() == 1)
		return 1;
	int m = nums.size();
	int* p = new int[m];
	p[0] = 1;
	if (((nums[0] == '1') && ((nums[1] >= '1') && (nums[1] <= '9'))) ||
		((nums[0] == '2') && ((nums[1] >= '1') && (nums[1] <= '6'))))
		p[1] = 2;
	else
		p[1] = 1;
	for (int i = 2; i<m; i++)
	{
		if (nums[i] == '0')
		{
			if (nums[i-1] == '1' || nums[i-1] == '2')
				p[i] = p[i - 2];
			else
				return 0;
		}
		else
		{
			if ((nums[i - 1] == '1') || ((nums[i - 1] == '2') && (nums[i] <= '6')))
				p[i] = p[i - 1] + p[i - 2];
			else
				p[i] = p[i - 1];
		}
	}
	return  p[m - 1];
}

int main()
{
	cout<<solve("72910721221427251718216239162221131917242")<<endl;

}